package com.wancaijinfu.parse;



import org.json.JSONException;
import org.json.JSONObject;

import com.wancaijinfu.javabean.UserData;

public class LoginParse extends PostParse {

	@Override
	Object parseSuccess(JSONObject object) throws JSONException {
		JSONObject obj = object.getJSONObject("user");
		UserData user = new UserData();
		//user.COOKIE = object.getString("Cookie");
		user.name = obj.getString("userName");
		user.password = obj.getString("password");
		user.mobile_phone_number = obj.getString("mobile_phone_number");
		
		
		user.id = obj.getString("id");
		if(obj.has("avatar"))
		user.head = obj.getString("avatar");
		if(obj.has("sex"))
		user.sex=obj.getString("sex");
		if(object.has("step"))
		user.step = object	.getInt("step");
		if(object.has("token"))
			user.token = object	.getString("token");
		//user.password = obj.getString("LOGINPASSWORD");		
		return user;
	}
}
